﻿// -----------------------------------------------------------------------
// <copyright company="Christoph van der Fecht - VDsoft">
// This code can be used in commercial, free and open source projects.
// </copyright>
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace VDsoft.SeriesNewsReader
{
	/// <summary>
	/// Interaction logic for Options.xaml
	/// </summary>
	public partial class Options : Window
	{
		public Options()
		{
			InitializeComponent();
		}

		/// <summary>
		/// Saves all settings and closes the dialog.
		/// </summary>
		/// <param name="sender">Object that raised the event.</param>
		/// <param name="e">Arguments of the event.</param>
		private void OnButtonOKClick(object sender, RoutedEventArgs e)
		{
			ViewModel.ViewModelLocator.OptionsView.SaveChanges();
			this.Close();
		}

		/// <summary>
		/// Closes the dialog without saveing the changes.
		/// </summary>
		/// <param name="sender">Object that raised the event.</param>
		/// <param name="e">Arguments of the event.</param>
		private void OnButtonCancleClick(object sender, RoutedEventArgs e)
		{
			this.Close();
		}

		private void OnDialogLoad(object sender, RoutedEventArgs e)
		{
			ViewModel.ViewModelLocator.OptionsView.LoadSettings();
		}
	}
}
